package com.atguigu.spzx;

import com.atguigu.spzx.common.constant.RedisConst;
import com.atguigu.spzx.common.log.annotation.EnableLogAspect;
import com.atguigu.spzx.manager.properties.MinioProperties;
import com.atguigu.spzx.manager.properties.UserAuthProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@EnableLogAspect
@MapperScan("com.atguigu.spzx.manager.mapper")
@EnableConfigurationProperties(value = {UserAuthProperties.class, MinioProperties.class})
public class ManagerApplication implements CommandLineRunner {
    @Autowired
    private RedissonClient redissonClient;
    public static void main(String[] args) {
        SpringApplication.run(ManagerApplication.class,args);
    }

    @Override
    public void run(String... args) throws Exception {
        RBloomFilter<Object> rBloomFilter = redissonClient.getBloomFilter(RedisConst.PRODUCT_BLOOM_FILTER);
        rBloomFilter.tryInit(1000 , 0.01) ;           // 参数1：预计存储的元素数量 参数2：误判率
    }
}
